﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CoreProject.IRepository;
using CoreProject.Model;
using Microsoft.EntityFrameworkCore;

namespace CoreProject.Repository
{
    public class GoodsTypeRepository : BaseRepository<GoodsType>, IGoodsTypeRepository
    {
        private readonly EFDbContext _dbContext;

        public GoodsTypeRepository(EFDbContext dbContext) : base(dbContext)
        {
            this._dbContext = dbContext;
        }

        public  async Task<List<GoodsType>> GetGoodsTypeAsync()
        {
           
            return await _dbContext.GoodsTypes
                .Include(n => n.Goods).ThenInclude(g=>g.GoodsPropertyKeys).ThenInclude(g => g.Gsk).ThenInclude(g=>g.GoodsPropertyKeys).ThenInclude(c => c.GoodsPropertyValues).ThenInclude(c=>c.Gsv)
                .ToListAsync();
        }
    }
}
